Drag-and-Drop¶

This example showcases adding volumes/meshes via drag-and-drop.

This first code cell creates a new nv object without any loaded volumes or meshes.

In [1]:
from ipyniivue import NiiVue

nv = NiiVue()
nv
Out[1]:

Now, try dragging and dropping a volume file, for example mni152.nii.gz. Then, run the next code cell to check that volumes have been loaded into the python backend.

In [2]:
nv.volumes
Out[2]:
[]

You can also modify this volume's features, such as its opacity.

In [3]:
if len(nv.volumes) > 0:
    nv.volumes[0].opacity = 0.5